<html> 
<head>
<script src=traversal.js language="JavaScript" type="text/JavaScript" ></script>
<title>Traversal Test</title> 
</head> 
<body>
<div id="test">
<span id="A">
    <span id="A.1">
    </span>
    <span id="A.2">
    </span>
    <span id="A.3">
    </span>
</span>
<span id="B">
    <span id="B.1">
        <span id="B.1.1">
        </span>
    </span>
</span>
<span id="C">
    <span id="C.1">
        <span id="C.1.1">
            <span id="C.1.1.1">
            </span>
            <span id="C.1.1.2">
            </span>
            <span id="C.1.1.3">
            </span>
        </span>
        <span id="C.1.2">
            <span id="C.2.1">
            </span>
        </span>
    </span>
</span>
<span id="D">
</span>
</div>
<div style="font-family: Courier; font-size: 14; white-space: pre">
<script>
if (window.testRunner)
    testRunner.dumpAsText();

var root = document.getElementById('test');
var start = document.getElementById('B');

function testNodeFiter(n)
{
    if (n.tagName == 'SPAN') return NodeFilter.FILTER_ACCEPT;
    return NodeFilter.FILTER_SKIP;
}

var tw = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, testNodeFiter, false);
tw.previousNode();
document.write(dumpTreeWalker(tw, start));
</script>
</div>
</body>
</html>
